<template>
    <div>
        <el-form ref="ruleFormRef" style="max-width: 600px" :model="ruleForm" :rules="rules" label-width="auto">
            <h2>注册</h2>
            <el-form-item label="用户名" prop="username">
                <el-input v-model="ruleForm.username" />
            </el-form-item>
            <el-form-item label="密码" prop="password">
                <el-input v-model="ruleForm.password" />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="submitForm(ruleFormRef)">
                    去登录
                </el-button>
                <el-button @click="resetForm(ruleFormRef)">去注册</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script setup>
import router from '@/router'
// import {qures} from '@/qures/qures'
import { ElMessage } from 'element-plus'
import { reactive, ref } from 'vue'
const ruleFormRef = ref()
const ruleForm = reactive({
    username: '',
    password: '',
})
const rules = reactive({
    username: [
        { required: true, message: '错误的', trigger: 'blur' },
        { min: 3, max: 13, message: '长度不超过五', trigger: 'blur' },
    ],
    password: [
        { required: true, message: '错误的', trigger: 'blur' },
        { min: 3, max: 13, message: '长度不超过五', trigger: 'blur' },
    ],
})
const resetForm = (formEl) => {
    if (!formEl) return
    formEl.resetFields()
    // qures.post('/register', ruleForm).then(res => {
    //     console.log(res);
    //     router.push('/login')
    // })

}
</script>

<style lang="scss" scoped></style>